package com.gxa.web_admin.controller.drivingManagement;

import com.gxa.common.base.RespResult;
import com.gxa.modules.dto.drivingManagement.QueryCarInfoDTO;
import com.gxa.modules.entity.CarInfo;
import com.gxa.modules.service.drivingManagementService.CarInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/carInfo")
//@RequiresPermissions(value = {"system:carInfo"})
public class CarInfoController {//车辆管理

    @Autowired
    private CarInfoService carInfoService;

    @PostMapping("/addCar")//添加车辆
    public RespResult addCar(CarInfo carInfo){

        return carInfoService.addCar(carInfo);
    }

    @GetMapping("/queryCarInfo")//查询全部车辆
    public RespResult queryCarInfo(QueryCarInfoDTO queryCarInfoDTO){

        return carInfoService.queryCarInfo(queryCarInfoDTO);
    }

    @GetMapping("/queryCarByCarNumberOrLicensePlate")////根据车辆编号或者车牌号查询车辆信息
    public RespResult queryCarByCarNumberOrLicensePlate(Integer carNumber,String licensePlate){

        return carInfoService.queryCarByCarNumberOrLicensePlate(carNumber,licensePlate);
    }

    @PostMapping("/updateCarInfo")
    public RespResult updateCarInfo(CarInfo carInfo){//更新车辆信息

        return carInfoService.updateCar(carInfo);
    }



}
